package org.example.domain.trade.service.settlement.factory;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.domain.trade.model.entity.*;
import org.example.domain.trade.service.lock.factory.TradeLockRuleFilterFactory;
import org.example.domain.trade.service.settlement.filter.EndRUleFilter;
import org.example.domain.trade.service.settlement.filter.OutTradeNoRuleFilter;
import org.example.domain.trade.service.settlement.filter.SCRuleFilter;
import org.example.domain.trade.service.settlement.filter.SettanleRuleFilter;
import org.example.types.design.framework.link.model2.LinkArmory;
import org.example.types.design.framework.link.model2.chain.BusinessLinkedList;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TradeSettlementRuleFilterFactory {
    @Bean("tradeSettlementRuleFilter")

public BusinessLinkedList<TradeSettlementRuleCommandEntity,
        TradeSettlementRuleFilterFactory.DynamicContext, TradeSettlementRuleFilterBackEntity>
tradeSettlementRuleFilter(SCRuleFilter scRuleFilter, OutTradeNoRuleFilter outTradeNoRuleFilter,
                          SettanleRuleFilter settanleRuleFilter, EndRUleFilter endRUleFilter)
    {
        //组装链
        LinkArmory<TradeSettlementRuleCommandEntity,
                TradeSettlementRuleFilterFactory.DynamicContext, TradeSettlementRuleFilterBackEntity>
                linkArmory=new LinkArmory<>("交易结算规则过滤链",
                scRuleFilter,
                outTradeNoRuleFilter,
                settanleRuleFilter,
                endRUleFilter);
        //链对象
        return linkArmory.getLogicLink();
    }




    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext{




        private MarketPayOrderEntity marketPayOrderEntity;
        private GroupBuyTeamEntity groupBuyTeamEntity;

    }

}
